package com.oocl.hw1.task3.view;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;

import com.oocl.hw1.task3.controller.Scannable;
import com.oocl.hw1.task3.controller.impl.CustomerProcessor;
import com.oocl.hw1.task3.controller.impl.CustomerScanner;

public class MainView implements ViewDelegate{
	private CustomerScanner customerScanner;
	
	public MainView(){
		customerScanner = new CustomerScanner(this, new CustomerProcessor());
	}
	
	public void start(){
		try {
			Scanner scan = new Scanner(new FileInputStream("customer.txt"));
			String line;
			while(scan.hasNextLine()){
				line = scan.nextLine();
				customerScanner.scanString(line);
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		customerScanner.getDataOrderById();
		customerScanner.getDataOrderByBirthday();
		customerScanner.getXMLDatas();
	}
	
	
	@Override
	public void showResultTips(String res) {
		System.out.println(res);
	}
	
	
	public static void main(String[] args) {
		new MainView().start();
	}
}
